{# Copyright 2015 Siemens AG

   Copying and distribution of this file, with or without modification,
   are permitted in any medium without royalty provided the copyright notice and this notice are preserved.
   This file is offered as-is, without any warranty.
#}
{% extends "include/base.html.twig" %}

{% block content %}
  <form name="formy" method="post">
    <ol>
      <li>{{ 'Select the folder that contains the upload'|trans }}:
        {% include 'components/select-folder.html.twig' with {'name': 'oldfolderid', 'id': 'oldfolderid', 'selected': folderId} %}
      </li>
      <li>{{ "Select the upload you wish to edit"|trans }}:
        {% if uploadId is not empty %}<input type="hidden" name="upload_pk" value="{{ uploadId }}" />
          {% import "include/macros.html.twig" as macro %}
          {{ macro.select('uploadselect',uploadList,'uploadselect',uploadId,uploadAction ~ 'class="ui-render-select2"') }}
        {% else %}
          {{ 'No upload available in this folder'|trans }}
        {% endif %}
      </li>

      <li>{{ 'Upload name'|trans }}: 
        <input type="text" name="newname" size="40" value="{{ uploadFilename|e }}" />
      </li>

      <li>{{ 'Upload description'|trans }}:
        <input type="text" name="newdesc" size="60" value="{{ uploadDesc|e }}" />
      </li>

    </ol>
    <input type="submit" value="{{ 'Edit'|trans }}" />
  </form>
 
{% endblock %}

{% block foot %}
  {{ parent() }}
  <script type="text/javascript">
    function js_url(val, url)
    {
      window.location.assign(url+val);
    }
    
    $(document).ready(function() {
      $('#oldfolderid').change(function(){
        window.location.href = "{{ baseUri }}" + $(this).val();
      });
    });
  </script>
{% endblock %}
